
<div class="modal fade" id="myModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
					  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
					<h4 class="modal-title" align="center">刷卡系统</h4>
					<br/>
					<form class="form-horizontal" id="shuakaform" onsubmit="return false" role="form">
									<div class="form-group">
										<label for="name" class="col-sm-offset-2 col-sm-2 control-label">账号</label>
										<div class="col-sm-5">
											<input type="text" id="cardNo" class="form-control" name="cardNo" placeholder="请输您的卡号">
										</div>
									</div>
									<div class="form-group">
										<label for="password" class="col-sm-offset-2 col-sm-2 control-label">地点</label>
										<div class="col-sm-5">
											<div class="layui-input-inline" style="width: 220px;">
												<select id="reaId" class="form-control" name="reaId" lay-verify="required">
													<option  value="-1">-请选择-</option>
												</select>
											</div>
										</div>
									</div>
									<div class="form-group">
										<div class="col-sm-offset-4 col-sm-5">
											<button id="shuaka" type="submit" class="btn">确定</button>
										</div>
									</div>
					</form>
			</div>
			<div class="modal-footer">
			</div>
		</div>
		<!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript">
		
		layui.use(['table','layer','form','laydate'],function(){
			var table = layui.table;
			var layer = layui.layer;
			var form = layui.form;
			var $ = layui.$;
			var laydate = layui.laydate;
			$.post("http://localhost:8085/getReadRoomsea",{},function(res){
				var html="";
				for (var i = 0; i < res.length; i++) {
					html+="<option value="+res[i].reaId+">"+
					res[i].reaName+"</option>"
				}
				$("#reaId").append(html);
				form.render("select");
			})
			
			
			$("#shuaka").click(function() {
				$.ajax({
					url : "http://localhost:8085/insertLog",
					data: $("#shuakaform").serialize(),
					success : function(data) {
						alert(data.msg);
						$("#cardid").val('');
						$("#reaId").val(-1);
						//document.getElementById("reaId").options[0].selected = true;					
					}
				});
			})
		})
		
		
</script>

<script type="text/javascript">
$(function(){

	window.onload=function(){
		$('#myModal').modal('show') //显示模态框
	}
	
});
</script>
